package edu.pw.treegrid.client.report.model;

import java.util.LinkedList;
import java.util.List;

public class ReportHierarchy {
        private String name;
        private List<ReportColumnDescriptionClient> columns = new LinkedList<ReportColumnDescriptionClient>();
       
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }
        public List<ReportColumnDescriptionClient> getColumns() {
                return columns;
        }
        public void addColumn(ReportColumnDescriptionClient column) {
                this.columns.add(column);
        }
        public String getLabel() {
                if(this.columns.isEmpty()) {
                    return getName();
                }
                StringBuilder sb = new StringBuilder();
                for(ReportColumnDescriptionClient rc: this.columns) {
                        sb.append(rc.getTitle());
                        sb.append("/");
                }
                return sb.toString();
        }
}
